package de.karlNet.login.attributeMapper;

import java.util.List;

import javax.naming.NamingException;
import javax.naming.directory.Attributes;

import de.karlNet.sambamanager.ldapModel.LdapObject;

public class LastExtractor extends LdapObjectExtractor {
        private LdapObject getLdapObject(Attributes attributes)
                        throws NamingException {
                String dn = this.tryToGetString("distinguishedname", attributes,
                                tryToGetString("dn", attributes));
                String cn = this.tryToGetString("name", attributes,
                                tryToGetString("cn", attributes));
                return new LdapObject(cn, dn);
        }
        @Override
        public LdapObject extract(Attributes attributes, List<String> objectClasses)
                        throws NamingException {
                return this.getLdapObject(attributes);
        }

}
